﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RxjhServer
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
            textBox1.Text = Aes.GetMachineCode();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Ini ini = new Ini(Application.StartupPath + "\\config.ini");
            if (Aes.Decrypt(Aes.Key1, textBox2.Text)?.StartsWith(Aes.GetMachineCode()) == true &&
                Aes.Decrypt(Aes.Key2, textBox3.Text)?.StartsWith(Aes.GetMachineCode()) == true)
            {
                ini.SetString("Key1", textBox2.Text);
                ini.SetString("Key2", textBox3.Text);
                Hide();
                new Form1().ShowDialog();
                Close();
            }
            else
            {
                MessageBox.Show("注册码不正确");
            }
        }
    }
}
